package com.dykj.fireFighting.server.fire.matterManagement.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dykj.fireFighting.api.fire.matterManagement.dto.MemorandumDto;
import com.dykj.fireFighting.api.fire.matterManagement.entity.Memorandum;
import com.dykj.fireFighting.api.fire.matterManagement.service.IMemorandumService;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.common.core.vo.PageVo;
import com.dykj.fireFighting.server.fire.matterManagement.mapper.MemorandumMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 维保app 备忘录
 *
 * @Author JacksonTu
 * @Date  2021-09-01 08:58:19
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class MemorandumServiceImpl extends BaseServiceImpl<MemorandumMapper, Memorandum> implements IMemorandumService {


    @Override
    public void deleteByIds(List<String> ids) {
        this.baseMapper.deleteByIds(ids);
    }

    @Override
    public PageVo<Memorandum> queryList(MemorandumDto memorandumDto) {
        HashMap<String, Object> params = new HashMap<>(16);
        params.put("unitId",memorandumDto.getUnitId());

        Page page = new Page();
        page.setCurrent(memorandumDto.getPage());
        page.setSize(memorandumDto.getLimit());

        return new PageVo<Memorandum>(this.baseMapper.queryList(page, params));
    }
}
